package com.mz361.modules.system.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mz361.common.enums.StatusEnum;
import com.mz361.common.utils.StatusUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author niceale
 * @date 2024/07/22
 */
@Data
@Entity
@Table(name = "std_invoices")
@EntityListeners(AuditingEntityListener.class)
@Where(clause = StatusUtil.NOT_DELETE)
public class Invoices implements Serializable {
    // 主键ID
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    // 发票号码
    @ApiModelProperty(notes = "发票号码")
    private String invoiceNo;
    // 开票主体
    @ApiModelProperty(notes = "开票主体")
    private String name = "满智（北京）科技有限公司";
    // 发票抬头
    @ApiModelProperty(notes = "发票抬头")
    private String invoiceTitle;
    // 项目名称
    @ApiModelProperty(notes = "项目名称")
    private String projectName = "*信息技术服务费*信息服务费";
    // 企业代码
    @ApiModelProperty(notes = "企业代码")
    private String companyNum;
    // 地址
    @ApiModelProperty(notes = "地址")
    private String address;
    // 电话
    @ApiModelProperty(notes = "电话")
    private String phone;
    // 邮箱
    @ApiModelProperty(notes = "邮箱")
    private String email;
    // 开户行
    @ApiModelProperty(notes = "开户行")
    private String depositBank;
    // 银行账户
    @ApiModelProperty(notes = "银行账户")
    private String bankAccount;
    // 发票金额
    @ApiModelProperty(notes = "发票金额")
    private String invoiceValue;
    // 发票地址
    @ApiModelProperty(notes = "发票地址")
    private String invoiceFile;
    // 发票类型，0:普票，1:专票
    @ApiModelProperty(notes = "发票类型")
    private String invoiceType;
    // 发票状态
    @ApiModelProperty(notes = "发票状态")
    private String invoiceStatus;
    // 驳回原因
    @ApiModelProperty(notes = "驳回原因")
    private String rejectionReason;
    // 申请人
    private String memeberId;
    //开票时间
    @ApiModelProperty(notes = "开票时间")
    private String invoiceDate;
    //申请时间
    @ApiModelProperty(notes = "申请时间")
    private String applyDate;
    // 备注
    @ApiModelProperty(notes = "备注")
    private String remark;

    //关联订单号
    private String orderIds;
    // 创建时间
    @CreatedDate
    @ApiModelProperty(notes = "申请时间")
    private Date createDate;
    // 更新时间
    @LastModifiedDate
    private Date updateDate;
    // 创建者
    @CreatedBy
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "create_by")
    @JsonIgnore
    private User createBy;
    // 更新者
    @LastModifiedBy
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "update_by")
    @JsonIgnore
    private User updateBy;
    // 数据状态
    private Byte status = StatusEnum.OK.getCode();
}